home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / BORLAND TURBO / RTLWIN32.PAK / HTTPEXT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  7.7 KB  |  229 lines

  1. /********
  2. *
  3. *  Copyright (c) 1995  Process Software Corporation
  4. *
  5. *  Copyright (c) 1995-1996  Microsoft Corporation
  6. *
  7. *
  8. *  Module Name  : HttpExt.h
  9. *
  10. *  Abstract :
  11. *
  12. *     This module contains  the structure definitions and prototypes for the
  13. *     version 2.0 HTTP Server Extension interface.
  14. *
  15. ******************/
  16.  
  17. /* $Copyright: 1997$ */
  18.  
  19. #ifndef _HTTPEXT_H_
  20. #define _HTTPEXT_H_
  21. #pragma option -b
  22.  
  23. #pragma option -b.
  24. #include <windows.h>
  25. #pragma option -b
  26.  
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31. #define   HSE_VERSION_MAJOR           2      // major version of this spec
  32. #define   HSE_VERSION_MINOR           0      // minor version of this spec
  33. #define   HSE_LOG_BUFFER_LEN         80
  34. #define   HSE_MAX_EXT_DLL_NAME_LEN  256
  35.  
  36. typedef   LPVOID  HCONN;
  37.  
  38. // the following are the status codes returned by the Extension DLL
  39.  
  40. #define   HSE_STATUS_SUCCESS                       1
  41. #define   HSE_STATUS_SUCCESS_AND_KEEP_CONN         2
  42. #define   HSE_STATUS_PENDING                       3
  43. #define   HSE_STATUS_ERROR                         4
  44.  
  45. // The following are the values to request services with the ServerSupportFunction.
  46. //  Values from 0 to 1000 are reserved for future versions of the interface
  47.  
  48. #define   HSE_REQ_BASE                             0
  49. #define   HSE_REQ_SEND_URL_REDIRECT_RESP           ( HSE_REQ_BASE + 1 )
  50. #define   HSE_REQ_SEND_URL                         ( HSE_REQ_BASE + 2 )
  51. #define   HSE_REQ_SEND_RESPONSE_HEADER             ( HSE_REQ_BASE + 3 )
  52. #define   HSE_REQ_DONE_WITH_SESSION                ( HSE_REQ_BASE + 4 )
  53. #define   HSE_REQ_END_RESERVED                     1000
  54.  
  55. //
  56. //  These are Microsoft specific extensions
  57. //
  58.  
  59. #define   HSE_REQ_MAP_URL_TO_PATH                  (HSE_REQ_END_RESERVED+1)
  60. #define   HSE_REQ_GET_SSPI_INFO                    (HSE_REQ_END_RESERVED+2)
  61. #define   HSE_APPEND_LOG_PARAMETER                 (HSE_REQ_END_RESERVED+3)
  62. #define   HSE_REQ_SEND_URL_EX                      (HSE_REQ_END_RESERVED+4)
  63. #define   HSE_REQ_IO_COMPLETION                    (HSE_REQ_END_RESERVED+5)
  64. #define   HSE_REQ_TRANSMIT_FILE                    (HSE_REQ_END_RESERVED+6)
  65. #define   HSE_REQ_REFRESH_ISAPI_ACL                (HSE_REQ_END_RESERVED+7)
  66.  
  67. //
  68. //  Bit Flags for TerminateExtension
  69. //
  70. //    HSE_TERM_ADVISORY_UNLOAD - Server wants to unload the extension,
  71. //          extension can return TRUE if OK, FALSE if the server should not
  72. //          unload the extension
  73. //
  74. //    HSE_TERM_MUST_UNLOAD - Server indicating the extension is about to be
  75. //          unloaded, the extension cannot refuse.
  76. //
  77.  
  78. #define HSE_TERM_ADVISORY_UNLOAD                   0x00000001
  79. #define HSE_TERM_MUST_UNLOAD                       0x00000002
  80.  
  81.  
  82. //
  83. // Flags for IO Functions, supported for IO Funcs.
  84. //  TF means ServerSupportFunction( HSE_REQ_TRANSMIT_FILE)
  85. //
  86.  
  87. # define HSE_IO_SYNC                      0x00000001   // for WriteClient
  88. # define HSE_IO_ASYNC                     0x00000002   // for WriteClient/TF
  89. # define HSE_IO_DISCONNECT_AFTER_SEND     0x00000004   // for TF
  90. # define HSE_IO_SEND_HEADERS              0x00000008   // for TF
  91.  
  92.  
  93.  
  94. //
  95. // passed to GetExtensionVersion
  96. //
  97.  
  98. typedef struct   _HSE_VERSION_INFO {
  99.  
  100.     DWORD  dwExtensionVersion;
  101.     CHAR   lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN];
  102.  
  103. } HSE_VERSION_INFO, *LPHSE_VERSION_INFO;
  104.  
  105.  
  106.  
  107.  
  108. //
  109. // passed to extension procedure on a new request
  110. //
  111. typedef struct _EXTENSION_CONTROL_BLOCK {
  112.  
  113.     DWORD     cbSize;                 // size of this struct.
  114.     DWORD     dwVersion;              // version info of this spec
  115.     HCONN     ConnID;                 // Context number not to be modified!
  116.     DWORD     dwHttpStatusCode;       // HTTP Status code
  117.     CHAR      lpszLogData[HSE_LOG_BUFFER_LEN];// null terminated log info specific to this Extension DLL
  118.  
  119.     LPSTR     lpszMethod;             // REQUEST_METHOD
  120.     LPSTR     lpszQueryString;        // QUERY_STRING
  121.     LPSTR     lpszPathInfo;           // PATH_INFO
  122.     LPSTR     lpszPathTranslated;     // PATH_TRANSLATED
  123.  
  124.     DWORD     cbTotalBytes;           // Total bytes indicated from client
  125.     DWORD     cbAvailable;            // Available number of bytes
  126.     LPBYTE    lpbData;                // pointer to cbAvailable bytes
  127.  
  128.     LPSTR     lpszContentType;        // Content type of client data
  129.  
  130.     BOOL (WINAPI * GetServerVariable) ( HCONN       hConn,
  131.                                         LPSTR       lpszVariableName,
  132.                                         LPVOID      lpvBuffer,
  133.                                         LPDWORD     lpdwSize );
  134.  
  135.     BOOL (WINAPI * WriteClient)  ( HCONN      ConnID,
  136.                                    LPVOID     Buffer,
  137.                                    LPDWORD    lpdwBytes,
  138.                                    DWORD      dwReserved );
  139.  
  140.     BOOL (WINAPI * ReadClient)  ( HCONN      ConnID,
  141.                                   LPVOID     lpvBuffer,
  142.                                   LPDWORD    lpdwSize );
  143.  
  144.     BOOL (WINAPI * ServerSupportFunction)( HCONN      hConn,
  145.                                            DWORD      dwHSERRequest,
  146.                                            LPVOID     lpvBuffer,
  147.                                            LPDWORD    lpdwSize,
  148.                                            LPDWORD    lpdwDataType );
  149.  
  150. } EXTENSION_CONTROL_BLOCK, *LPEXTENSION_CONTROL_BLOCK;
  151.  
  152. //
  153. //  these are the prototypes that must be exported from the extension DLL
  154. //
  155.  
  156. BOOL  WINAPI   GetExtensionVersion( HSE_VERSION_INFO  *pVer );
  157. DWORD WINAPI   HttpExtensionProc(  EXTENSION_CONTROL_BLOCK *pECB );
  158. BOOL  WINAPI   TerminateExtension( DWORD dwFlags );
  159.  
  160. // the following type declarations is for the server side
  161.  
  162. typedef BOOL  (WINAPI * PFN_GETEXTENSIONVERSION)( HSE_VERSION_INFO  *pVer );
  163. typedef DWORD (WINAPI * PFN_HTTPEXTENSIONPROC )( EXTENSION_CONTROL_BLOCK *pECB );
  164. typedef BOOL  (WINAPI * PFN_TERMINATEEXTENSION )( DWORD dwFlags );
  165.  
  166. typedef VOID
  167.   (WINAPI * PFN_HSE_IO_COMPLETION)(
  168.                                    IN EXTENSION_CONTROL_BLOCK * pECB,
  169.                                    IN PVOID    pContext,
  170.                                    IN DWORD    cbIO,
  171.                                    IN DWORD    dwError
  172.                                    );
  173.  
  174.  
  175.  
  176.  
  177. //
  178. // HSE_TF_INFO defines the type for HTTP SERVER EXTENSION support for
  179. //  ISAPI applications to send files using TransmitFile.
  180. // A pointer to this object should be used with ServerSupportFunction()
  181. //  for HSE_REQ_TRANSMIT_FILE.
  182. //
  183.  
  184. typedef struct _HSE_TF_INFO  {
  185.  
  186.     //
  187.     // callback and context information
  188.     // the callback function will be called when IO is completed.
  189.     // the context specified will be used during such callback.
  190.     //
  191.     // These values (if non-NULL) will override the one set by calling
  192.     //  ServerSupportFunction() with HSE_REQ_IO_COMPLETION
  193.     //
  194.     PFN_HSE_IO_COMPLETION   pfnHseIO;
  195.     PVOID  pContext;
  196.  
  197.     // file should have been opened with FILE_FLAG_SEQUENTIAL_SCAN
  198.     HANDLE hFile;
  199.  
  200.     //
  201.     // HTTP header and status code
  202.     // These fields are used only if HSE_IO_SEND_HEADERS is present in dwFlags
  203.     //
  204.  
  205.     LPCSTR pszStatusCode; // HTTP Status Code  eg: "200 OK"
  206.  
  207.     DWORD  BytesToWrite;  // special value of "0" means write entire file.
  208.     DWORD  Offset;        // offset value within the file to start from
  209.  
  210.     PVOID  pHead;         // Head buffer to be sent before file data
  211.     DWORD  HeadLength;    // header length
  212.     PVOID  pTail;         // Tail buffer to be sent after file data
  213.     DWORD  TailLength;    // tail length
  214.  
  215.     DWORD  dwFlags;       // includes HSE_IO_DISCONNECT_AFTER_SEND, ...
  216.  
  217. } HSE_TF_INFO, * LPHSE_TF_INFO;
  218.  
  219.  
  220.  
  221.  
  222.  
  223. #ifdef __cplusplus
  224. }
  225. #pragma option -b.
  226. #endif
  227.  
  228. #endif  // end definition _HTTPEXT_H_
  229.